package com.handinfo.android;

import android.content.Context;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;

import com.handinfo.android.core.graphics.DWGraphics;
import com.handinfo.android.core.graphics.DWScreen;
import com.handinfo.android.core.input.DWInputConnection;

public class DWGameView extends SurfaceView implements SurfaceHolder.Callback
{
	protected Context m_context;
	protected DWGraphics m_graphics;
	protected SurfaceHolder m_holder;
	protected DWScreen m_screen;

	public DWGameView(Context context)
	{
		super(context);
		m_context = context;
		m_holder = getHolder();
		m_holder.addCallback(this);
		setWillNotDraw(false);
        setFocusable(true); 
		requestFocus();
		requestFocusFromTouch();
		setOnTouchListener(DWScreen.Instance.getInput());

		setFocusableInTouchMode(true);
	}

	public String inputText;
	public String m_cache_text = null;

	public InputConnection onCreateInputConnection(EditorInfo outAttrs)
	{
		/* 在此处可设置outAttrs定制键盘的类型 */
		return new DWInputConnection(this, false);
	}

	public void surfaceCreated(SurfaceHolder holder)
	{
		System.out.println("surfaceCreated");
	}

	public void surfaceChanged(SurfaceHolder holder, int format, int width,
			int height)
	{
		System.out.println("surfaceChanged");
	}

	public void surfaceDestroyed(SurfaceHolder holder)
	{
		System.out.println("surfaceDestroyed");
	}

	public void addView(View view)
	{

	}
}
